<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
    <title>股市行情</title>
</head>
<style>
    body {
        font-family: 'Segoe UI', Arial, sans-serif;
        margin: 20px;
        background-color: #f5f6fa;
    }

    .container {
        max-width: 1000px;
        margin: 0 auto;
        background: white;
        padding: 30px;
        border-radius: 12px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }

    .status-table {
        width: 100%;
        border-collapse: collapse;
        margin-top: 20px;
    }

    .status-table td, .navbar-inner th {
        padding: 15px;
        border-bottom: 1px solid #eee;
        font-size: 14px;
    }

    .status-table tr:last-child td {
        border-bottom: none;
    }

    .status-table tr:hover {
        background-color: #f8f9fa;
    }

    .up {
        color: #ff4d4f;
        font-weight: 600;
    }

    .down {
        color: #52c41a;
        font-weight: 600;
    }

    .label {
        padding: 4px 8px;
        border-radius: 4px;
        font-size: 12px;
    }

    h2 {
        color: #1a1a1a;
        margin-bottom: 25px;
        text-align: center;
        font-size: 24px;
    }

    @media (max-width: 768px) {
        .container {
            padding: 15px;
        }

        .status-table td, .navbar-inner th {
            padding: 12px 8px;
            font-size: 13px;
        }
    }

    .navbar-inner th {
        text-align: left;
        font-size: 15px;
    }

    /* 新增悬浮按钮样式 */
    .refresh-btn {
        position: fixed;
        bottom: 30px;
        right: 30px;
        background: #1890ff;
        color: white;
        width: 50px;
        height: 50px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        transition: all 0.3s;
        border: none;
        z-index: 1000;
        font-size: 20px;
        font-weight: bold;
    }

    .refresh-btn:hover {
        background: #40a9ff;
        transform: scale(1.1);
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    }

    .refresh-btn:active {
        transform: scale(0.95);
    }
</style>
<body>
<div class="container">
    <h2>{{ title }}</h2>
    <table class="status-table">
        <thead class="navbar-inner" style="display: none">
        <tr>
            <th style="width: 100px;"></th>
            <th></th>
            <th></th>
            <th style="width: 45px;"></th>
        </tr>
        </thead>
        {% for item in market_index %}
            <tr>
                <td class="{% if item.is_rise == 1 %}up{% else %}down{% endif %}">{{ item.title }}</td>
                <td class="{% if item.is_rise == 1 %}up{% else %}down{% endif %}">
                    {{ item.value }}
                </td>
                <td class="{% if item.is_rise == 1 %}up{% else %}down{% endif %}">
                    {{ item.number }} <br> {{ item.rate }}
                </td>
                <td>
                    <span class="{% if item.is_rise == 1 %}up{% else %}down{% endif %} label">
                    {% if item.is_rise == 1 %}
                        ▲ 涨
                    {% else %}
                        ▼ 跌
                    {% endif %}
                    </span>
                </td>
            </tr>
        {% endfor %}
    </table>

    <!-- 新增刷新按钮 -->
    <button class="refresh-btn" onclick="refreshPage()" aria-label="刷新数据">↻</button>
</div>
</body>

<script>
    // 禁用缩放（针对某些Android浏览器）
    document.addEventListener('gesturestart', function (e) {
        e.preventDefault();
    });

    // 刷新页面函数
    function refreshPage() {
        location.reload();
        // 实际使用时可以替换为Ajax数据刷新
    }

    // 禁用键盘缩放（Ctrl + +/-）
    document.addEventListener('keydown', function (e) {
        if ((e.ctrlKey || e.metaKey) && (e.keyCode === 107 || e.keyCode === 109)) {
            e.preventDefault();
        }
    });
</script>
</html>

